import lazyLoadView from '@/router/lazy-load';

import { DEFAULT_LAYOUT } from '../base';
import { AppRouteRecordRaw } from '../types';

const Organization: AppRouteRecordRaw = {
  path: '/organization',
  name: 'Organization',
  component: DEFAULT_LAYOUT,
  meta: {
    locale: 'menu.organization',
    requiresAuth: true,
    icon: 'icon-home',
    order: 1,
    roleCode: 'GROUP_INST_ADMIN',
  },
  children: [
    {
      path: 'nursing-home',
      name: 'NursingHome',
      component: lazyLoadView(
        () => import('@/views/organization/nursing-home/index.vue')
      ),
      meta: {
        locale: 'menu.organization.nursingHome',
        requiresAuth: true,
        roleCode: 'GROUP_BRANCH',
        pageName: '院区列表',
      },
    },
    {
      path: 'room',
      name: 'Room',
      component: lazyLoadView(
        () => import('@/views/organization/room/index.vue')
      ),
      meta: {
        locale: 'menu.organization.room',
        requiresAuth: true,
        roleCode: 'GROUP_ROOM',
        pageName: '房间列表',
      },
    },
    {
      path: 'room-detail',
      name: 'RoomDetail',
      component: lazyLoadView(
        () => import('@/views/organization/room/detail.vue')
      ),
      meta: {
        locale: 'menu.organization.roomDetail',
        requiresAuth: true,
        roleCode: 'GROUP_ROOM',
        hideInMenu: true,
      },
    },
    {
      path: 'department',
      name: 'Department',
      component: lazyLoadView(
        () => import('@/views/organization/department/index.vue')
      ),
      meta: {
        locale: 'menu.organization.department',
        requiresAuth: true,
        roleCode: 'GROUP_DEPT',
        pageName: '部门列表',
      },
    },
    {
      path: 'staff',
      name: 'Staff',
      component: lazyLoadView(
        () => import('@/views/organization/staff/index.vue')
      ),
      meta: {
        locale: 'menu.organization.staff',
        requiresAuth: true,
        roleCode: 'GROUP_STAFF',
        pageName: '员工列表',
      },
    },
    {
      path: 'work-scheduling',
      name: 'WorkScheduling',
      component: lazyLoadView(
        () => import('@/views/organization/work-scheduling/index.vue')
      ),
      meta: {
        locale: 'menu.organization.workScheduling',
        requiresAuth: true,
        roleCode: 'GROUP_SCHEDULING',
        pageName: '排班列表',
      },
    },
  ],
};

export default Organization;
